<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title></title>
  <style>
    .active {
      background-color: blueviolet;
    }
  </style>
  <script type='text/javascript' src='js/vue.js'></script>
</head>

<body>
  <div id='app'>
    <div :class="{active:isActive }">{{ msg }}</div>
    <button @click="toggle">toggle</button>
    <div :class="['a1','a2',isActive?'':'active']">{{ msg }}</div>
  </div>
  <script type='text/javascript'>
    var vm = new Vue({
      el: '#app',
      data: {
        msg: 'Hello Vue',
        isActive: true,

      },
      methods: {
        toggle() {
          this.isActive = !this.isActive
        }
      },
    });
  </script>
</body>

</html>